<?php
 header('content-type:text/html;charset=utf-8');
  
  
  
  
  function foo($x){

   $y = ltrim(strrchr($x,'.'),'.');
    
    if($y == 'jpg'or$y== 'png'or$y == 'bmp'or$y == 'gif'){
    	echo '是图片';
    }else{
    	echo '不是图片';
    }
    
  	
  }
  
	$x = 'xunlaoshi.123.omg.bgm.jpg';
    
    foo($x);
?>